package com.shop2cn.app.liveseller.testcase;


import com.shop2cn.app.liveseller.parameter.*;
import com.shop2cn.app.liveseller.service.*;
import com.ymatou.mq.admin.parameter.MessageListBean;
import com.ymttest.business.service.AuthCallServiceV2;
import com.ymttest.business.service.LiveRoomShop2cnCallService;
import com.ymttest.business.service.MqQueryCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.livesellerShop2cn.*;
import com.ymttest.database.sqlwapper.livesellerShop2cn.LiveRoomShop2cnWapper;
import com.ymttest.utils.TestDataManager;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;

import org.apache.http.client.ClientProtocolException;
import org.junit.*;
import org.junit.experimental.categories.Category;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 直播第三方回调通知 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_LiveNotify {
	private static StreamLiveNotifyBean streamlivenotifyBean;
	private static LiveNotifyCall livenotifyCall;
	private static LiveRoomShop2cnWapper LiveRoomShop2cnWapper;
	private static RecLiveNotifyBean recivenotifyBean;
	private static int sellerId ;
	private static String token ;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("直播第三方回调通知");
		try {
			sellerId = GodmchManageCallService.CreateSellerMch();
			token=AuthCallServiceV2.createToken(sellerId, "app");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Before
	public void caseUp() {
		streamlivenotifyBean = new StreamLiveNotifyBean();
		livenotifyCall = new LiveNotifyCall();
		LiveRoomShop2cnWapper = new LiveRoomShop2cnWapper();
		recivenotifyBean = new RecLiveNotifyBean();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(livenotifyCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_LiveNotify_001() {
		Logger.start(true, "直播第三方回调通知成功推流");
		try {
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 1);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
//			if(livenotifyCall.getString("code").equals("500")) {
//				TestDataManager.RunYumUpdate("172.16.101.120", "root", "ymt@123");
//				livenotifyCall.callService();
//			}
			Thread.sleep(1000);
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.debug(FormatUtil.beanToGSONString(dbliveroom));
			Logger.verifyEquals(2, dbliveroom.getLiveStatus(), "验证LiveStatus");
			Logger.verifyEquals(1, dbliveroom.getLivePush(), "验证LivePush");
			verifyPushStream(liveroom.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_LiveNotify_002() {
		Logger.start(true, "直播第三方回调通知成功断流");
		try {
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			Logger.comment("先推流再断流");
			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 1);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			verifyPushStream(liveroom.getId());
			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 0);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			Thread.sleep(1000);
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(3, dbliveroom.getLiveStatus(), "验证LiveStatus");
			Logger.verifyEquals(1, dbliveroom.getLivePush(), "验证LivePush");
			verifyAbortStream(liveroom.getId());
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_LiveNotify_003() {
		Logger.start(true, "直播第三方回调通知成功新的录制文件已生成");
		try {
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			Logger.comment("先推流再接受第三方通知");
			recivenotifyBean = LiveRoomShop2cnCallService.initRecLiveNotifyBean(liveroom.getId(), 100);
			livenotifyCall.setData(recivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(recivenotifyBean.getVideo_url(), dbliveroom.getHistoryPlayUrl(), "验证getHistoryPlayUrl");
			Map m = LiveRoomShop2cnWapper.selectLivereplayById(dbliveroom.getId().toString());
			Logger.verifyEquals(recivenotifyBean.getFile_id(), m.get("FileId").toString(), "验证FileId");
			Logger.verifyEquals(recivenotifyBean.getDuration(), m.get("ReplayTime").toString(), "验证ReplayTime");
			Logger.verifyEquals(recivenotifyBean.getVideo_url(), m.get("ReplayUrl").toString(), "验证ReplayUrl");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	@Ignore
	public void Tc_LiveNotify_004() {
		Logger.start(true, "直播第三方回调通知成功新的截图文件已生成");
		try {
			// TODO 补全case代码
			org.junit.Assert.fail();
			// livenotifyCall.setData(livenotifyBean);
			livenotifyCall.callService();

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_LiveNotify_005() {
		Logger.start(true, "签名错误失败");
		try {
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 1);
			streamlivenotifyBean.setSign("1");
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("500", livenotifyCall.getString("code"), "验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_LiveNotify_006() {
		Logger.start(true, "未推流直播第三方回调通知成功断流,状态不变0->0");
		try {
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 0);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(0, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_LiveNotify_007() {
		Logger.start(true, "系统自动关闭直播7不再接受直播第三方回调通知成功推流变更");
		try {
			int updatestatus = 7;
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			LiveRoomShop2cnWapper.updateLiveRoomPushStatus(liveroom.getId(), updatestatus);

			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 1);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(updatestatus, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_LiveNotify_008() {
		Logger.start(true, "系统自动关闭直播7不再接受直播第三方回调通知成功断流变更");
		try {
			int updatestatus = 7;
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			LiveRoomShop2cnWapper.updateLiveRoomPushStatus(liveroom.getId(), updatestatus);

			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 0);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(updatestatus, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_LiveNotify_009() {
		Logger.start(true, "直播第三方回调通知成功断流再推流成功");
		try {
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			Logger.comment("先推流再断流再推流");
			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 1);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			verifyPushStream(liveroom.getId());
			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 0);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			verifyAbortStream(liveroom.getId());
			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 1);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			verifyPushStream(liveroom.getId());
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(2, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_LiveNotify_010() {
		Logger.start(true, "关闭直播8不再接受直播第三方回调通知成功推流变更");
		try {
			int updatestatus = 8;
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			LiveRoomShop2cnWapper.updateLiveRoomPushStatus(liveroom.getId(), updatestatus);

			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 1);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(updatestatus, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_LiveNotify_011() {
		Logger.start(true, "结束直播9不再接受直播第三方回调通知成功推流变更");
		try {
			int updatestatus = 9;
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			LiveRoomShop2cnWapper.updateLiveRoomPushStatus(liveroom.getId(), updatestatus);

			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 1);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(updatestatus, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_LiveNotify_012() {
		Logger.start(true, "强制关停10不再接受直播第三方回调通知成功推流变更");
		try {
			int updatestatus = 10;
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			LiveRoomShop2cnWapper.updateLiveRoomPushStatus(liveroom.getId(), updatestatus);

			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 1);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(updatestatus, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_LiveNotify_013() {
		Logger.start(true, "关闭直播8不再接受直播第三方回调通知成功断流变更");
		try {
			int updatestatus = 8;
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			LiveRoomShop2cnWapper.updateLiveRoomPushStatus(liveroom.getId(), updatestatus);

			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 0);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(updatestatus, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_LiveNotify_014() {
		Logger.start(true, "结束直播9不再接受直播第三方回调通知成功断流变更");
		try {
			int updatestatus = 9;
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			LiveRoomShop2cnWapper.updateLiveRoomPushStatus(liveroom.getId(), updatestatus);

			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 0);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(updatestatus, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_LiveNotify_015() {
		Logger.start(true, "强制关停10不再接受直播第三方回调通知成功断流变更");
		try {
			int updatestatus = 10;
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			LiveRoomShop2cnWapper.updateLiveRoomPushStatus(liveroom.getId(), updatestatus);

			streamlivenotifyBean = LiveRoomShop2cnCallService.initStreamLiveNotifyBean(liveroom.getId(), 0);
			livenotifyCall.setData(streamlivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(updatestatus, dbliveroom.getLiveStatus(), "验证LiveStatus");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_LiveNotify_016() {
		Logger.start(true, "直播第三方回调通知成功新的录制文件已生成-第二次ReplayTime大于第一次更新记录");
		try {
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			Logger.comment("先推流再接受第三方通知");
			recivenotifyBean = LiveRoomShop2cnCallService.initRecLiveNotifyBean(liveroom.getId(), 100);
			livenotifyCall.setData(recivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(recivenotifyBean.getVideo_url(), dbliveroom.getHistoryPlayUrl(), "验证getHistoryPlayUrl");
			Map m = LiveRoomShop2cnWapper.selectLivereplayById(dbliveroom.getId().toString());
			Logger.verifyEquals(recivenotifyBean.getFile_id(), m.get("FileId").toString(), "验证FileId");
			Logger.verifyEquals(recivenotifyBean.getDuration(), m.get("ReplayTime").toString(), "验证ReplayTime");
			Logger.verifyEquals(recivenotifyBean.getVideo_url(), m.get("ReplayUrl").toString(), "验证ReplayUrl");
			
			recivenotifyBean.setFile_size(1+recivenotifyBean.getFile_size());
			recivenotifyBean.setDuration(1+recivenotifyBean.getDuration());
			recivenotifyBean.setFile_id(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(recivenotifyBean.getVideo_url(), dbliveroom.getHistoryPlayUrl(), "验证getHistoryPlayUrl");
			m = LiveRoomShop2cnWapper.selectLivereplayById(dbliveroom.getId().toString());
			Logger.debug(m);
			Logger.verifyEquals(recivenotifyBean.getFile_id(), m.get("FileId").toString(), "验证FileId");
			Logger.verifyEquals(recivenotifyBean.getDuration(), m.get("ReplayTime").toString(), "验证ReplayTime");
			Logger.verifyEquals(recivenotifyBean.getVideo_url(), m.get("ReplayUrl").toString(), "验证ReplayUrl");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_LiveNotify_017() {
		Logger.start(true, "直播第三方回调通知成功新的录制文件已生成-第二次ReplayTime小于第一次不更新记录");
		try {
			LiveRoom liveroom = LiveRoomShop2cnCallService.CreateSellerLive(LiveRoomShop2cnCallService.initCreatesellerliveBean(),sellerId);
			LiveRoomShop2cnCallService.UpdateLiveTimeToStart(liveroom.getId());
			Logger.comment("先推流再接受第三方通知");
			recivenotifyBean = LiveRoomShop2cnCallService.initRecLiveNotifyBean(liveroom.getId(), 100);
			livenotifyCall.setData(recivenotifyBean);
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			LiveRoom dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(recivenotifyBean.getVideo_url(), dbliveroom.getHistoryPlayUrl(), "验证getHistoryPlayUrl");
			Map m = LiveRoomShop2cnWapper.selectLivereplayById(dbliveroom.getId().toString());
			Logger.verifyEquals(recivenotifyBean.getFile_id(), m.get("FileId").toString(), "验证FileId");
			Logger.verifyEquals(recivenotifyBean.getDuration(), m.get("ReplayTime").toString(), "验证ReplayTime");
			Logger.verifyEquals(recivenotifyBean.getVideo_url(), m.get("ReplayUrl").toString(), "验证ReplayUrl");
			
			String ofid=recivenotifyBean.getFile_id();
			String ofrt=recivenotifyBean.getDuration();
			String ofurl=recivenotifyBean.getVideo_url();
			recivenotifyBean.setFile_size("1");
			recivenotifyBean.setDuration("1");
			recivenotifyBean.setFile_id(TestDataManager.getRandomUUID().toString().replaceAll("-", ""));
			livenotifyCall.callService();
			Logger.verifyEquals("0", livenotifyCall.getString("code"), "验证code");
			dbliveroom = LiveRoomShop2cnWapper.selectLiveRoomById(liveroom.getId());
			Logger.verifyEquals(recivenotifyBean.getVideo_url(), dbliveroom.getHistoryPlayUrl(), "验证getHistoryPlayUrl");
			m = LiveRoomShop2cnWapper.selectLivereplayById(dbliveroom.getId().toString());
			Logger.debug(m);
			Logger.verifyEquals(ofid, m.get("FileId").toString(), "验证FileId");
			Logger.verifyEquals(ofrt, m.get("ReplayTime").toString(), "验证ReplayTime");
			Logger.verifyEquals(ofurl, m.get("ReplayUrl").toString(), "验证ReplayUrl");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	private void verifyPushStream(Integer liveId) throws ClientProtocolException, IOException, InterruptedException {
//		Logger.comment("验证总线发送消息");
//		MessageListBean MessageListBean = MqQueryCallService.initSteamSync(liveId);
//		List<Map> joa = MqQueryCallService.GetMqMessage(MessageListBean);
//		int redo=0;
//		while(joa.size()==0&&redo<5){
//			redo++;
//			Thread.sleep(5000);
//			joa = MqQueryCallService.GetMqMessage(MessageListBean);
//		}
//		//Logger.verifyEquals(1, joa.size(), "验证发送总线消息");
//		Logger.verifyEquals(liveId.toString(),joa.get(0).get("LiveId").toString(), "验证liveId");
		Thread.sleep(5000);
		LiveRoom createLive = new LiveRoomShop2cnWapper().selectLiveRoomById(liveId);
		Integer status = createLive.getLiveStatus();
		Logger.verifyEquals(2, status, "验证status为2");
	}
	private void verifyAbortStream(Integer liveId) throws ClientProtocolException, IOException, InterruptedException {
//		Logger.comment("验证总线发送消息");
//		MessageListBean MessageListBean = MqQueryCallService.initSteamSync(liveId);
//		List<Map> joa = MqQueryCallService.GetMqMessage(MessageListBean);
//		int redo=0;
//		while(joa.size()==0&&redo<5){
//			redo++;
//			Thread.sleep(5000);
//			joa = MqQueryCallService.GetMqMessage(MessageListBean);
//		}
		//Logger.verifyEquals(2, joa.size(), "验证发送总线消息");
//		Logger.verifyEquals(liveId.toString(),joa.get(0).get("LiveId").toString(), "验证liveId");
		Thread.sleep(5000);
		LiveRoom createLive = new LiveRoomShop2cnWapper().selectLiveRoomById(liveId);
		Integer status = createLive.getLiveStatus();
		Logger.verifyEquals(3, status, "验证status为3");
	}
}